import os,requests,json,datetime
res=requests.post('http://127.0.0.1:5000/course/sendsms',data={'mobile':'18203622555'})
mes=json.loads(res.text)
code=mes['sms']
print(code)
res1=requests.post('http://127.0.0.1:5000/course/login',data={'mobile':'18203622555','code':code})
mes1=json.loads(res1.text)
flag='not pass'
print(int(mes1['code']))
if int(mes1['code'])==201:
    flag='pass'

#
#
report={'Url':'http://127.0.0.1:5000/course/sendsms','method':'POST','params':'mobile','result':mes1,'realresult':flag}
filename=datetime.datetime.now().strftime('%Y-%m-%d')
with open(os.path.join('../logs/'+filename+'.txt'),'w',encoding='utf8') as f:
    f.write(json.dumps(report,ensure_ascii=False))